##cmake_minimum_required( VERSION 2.8 )
project("rezervilo report plugin event")
find_package( Qt4 REQUIRED )

ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS(-DQT_PLUGIN)
ADD_DEFINITIONS(-DQT_NO_DEBUG)
ADD_DEFINITIONS(-DQT_SHARED)

include( ${QT_USE_FILE} )
INCLUDE_DIRECTORIES(
    ${QT_INCLUDE_DIR}
    ${QT_QTSQL_INCLUDE_DIR}
    ${CMAKE_CURRENT_BINARY_DIR}
    ../../../client/
)


set( HEADERS
    rept_event.h
    diapre.h
    diaprint.h

	)
set( SOURCES 
    rept_event.cpp
    diapre.cpp
    diaprint.cpp
	)

set( UIS
    diapre.ui
    diaprint.ui
)

qt4_wrap_ui(UIS_H ${UIS})

qt4_wrap_cpp(MOC ${HEADERS})

set( RESOURCES res.qrc )
qt4_add_resources( QRC_SOURCES ${RESOURCES} )

add_library(rept_event SHARED ${SOURCES} ${MOC} ${UIS_H} ${QRC_SOURCES})

target_link_libraries(rept_event ${QT_LIBRARIES} ) #${QT_QTSQL_LIBRARIES})

# install for linux
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
        set(rootdir ${CMAKE_INSTALL_PREFIX})
        set(libdir ${rootdir}/lib/usldb)
        install(TARGETS rept_event DESTINATION ${libdir})
endif()

# install for mac
if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
        set(rootdir ${CMAKE_INSTALL_PREFIX})
        set(libdir ${rootdir}/lib/usldb)
        install(TARGETS rept_event DESTINATION ${libdir})
endif()
